<template>
    <rx-layout>
        <template v-slot:header>
            <rx-filters :isBpmClient="false"
                        :isMyBpm="isMyBpmClient"
                        :readType="readType"
                        :readKey="readKey"
                        :screenName="screenName"
                        :keyname="getTreeCatByList.key" :namelit="getTreeCatByList.name"
                        @loadListByParams="loadListByParams"
                        :placeholder="i18n('forwardName','请输入转发名称','input')"></rx-filters>
        </template>
        <template v-slot:center>
            <rx-grid ref="rxGrid" :queryParam="queryParam" :url="'/api-bpm/bpm/core/bpmInstCc/getMyTurnTo'">
                <template v-slot:center="{record}">
                    <view class="rx-center" @click="bpmDetails(record)">
                        <view class="rx-html" v-if="getStatusHtml(record.ccType)"
                              v-html="getStatusHtml(record.ccType)"></view>
                        <view class="rx-createTime">
                            <my-icon style="color: rgba(66, 133, 244, 1);font-size: 1.2rem"
                                     type="icon-linetime"></my-icon>
                            <view class="rx-createTime-name">{{ record.updateTime }}</view>
                        </view>
                        <view class="rx-top">
                            <view class="rx-icon-le"><view class="rx-icon_liucheng"><my-icon type="icon-Vue3jpaas-icon_liucheng"></my-icon></view></view>
                            <view class="rx-subject">{{ record.subject }}</view>
                        </view>
                        <view class="rx-bottom">
                            <view>
                                <span class="rx-bottom-span">{{ i18n('forwardNode', '转发节点') }}:</span>
                                <span>{{ $i18(record.nodeName) }}</span>
                            </view>
                        </view>
                        <view class="rx-operate" >
                            <view class="rx-operate-button" @click.stop="bpmDetails(record)">
                                <my-icon type="icon-icon-test-copy"></my-icon>
                                <view class="rx-operate-name"> {{ $ti18('mobileList.detailBtn', '明细') }}</view>
                            </view>
                            <view class="rx-operate-button" @click.stop="getReading(record)">
                                <my-icon type="icon-Vue3_notice"></my-icon>
                                <view class="rx-operate-name">{{ $ti18('mobileList.reading', '阅读情况') }}</view>
                            </view>
                        </view>
                    </view>
                </template>
            </rx-grid>
        </template>
    </rx-layout>
</template>

<script>
import RxGrid from '@/components/RxGrid'
import RxLayout from '@/components/RxLayout'
import RxFilters from '@/components/RxFilters'
import instAndTaskShareApi from "@/api/instAndTaskShareApi";
import getStatusHtml from '@/common/getStatusHtml.js'
import Util from '@/js/Util.js'

export default {
    name: "RxMyTransmit",
    components: {RxGrid, RxLayout, RxFilters},
    mixins: [getStatusHtml],
    data() {
        return {
            isMyBpmClient: true,
            readKey: "task.read",
            readType: "instCcHist",
            isInit: true,
            getTreeCatByList: '',
            queryParam: {},//筛选参数
            screenName:'SUBJECT'
        }
    },
    created() {
        this.getTreeCatByKey()
    },
    onShow(){
        if(this.$refs.rxGrid){
            this.$refs.rxGrid.getInit(true, true);
        }
    },
    methods: {
        i18n(name, text, key) {
            return this.$ti18(name, text, "bpmLang", key);
        },
        getTreeCatByKey() {
            instAndTaskShareApi.getTreeCatByKey().then(ret => {
                this.getTreeCatByList = ret;
            })
        },
        //筛选
        loadListByParams(params) {
            this.queryParam = params
        },
        bpmDetails(obj) {
            let params = {
                instId: obj.instId,
                routerName: 'openDoc',
                action: 'detail'
            }
            let appId = obj.appId;
            if (!appId) {
                appId = Util.getAppId(this);
            }
            uni.navigateTo({
                url: '/views/modules/bpm/OpenDoc?params=' + JSON.stringify(params) + '&appId=' + appId
            })
        },
        getReading(obj) {
            let appId = obj.appId;
            if (!appId) {
                appId = Util.getAppId(this);
            }
            let params = {
                instId: obj.instId
            }
            uni.navigateTo({
                url: '/pages/RxProcessManagement/RxMyTransmit/ReadingList?params=' + JSON.stringify(params) + '&appId=' + appId
            })
        }
    }
}
</script>

<style scoped>
@import "../RxProcessManagement.css";
</style>
